/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.cip.esymons.tramite.be.Expediente;

/**
 *
 * @author ChristianATE
 */
@Stateless
public class ExpedienteFacade implements ExpedienteFacadeLocal {
    
    @PersistenceContext
    private EntityManager em;

    public void create(Expediente expediente) {
        em.persist(expediente);
    }

    public void edit(Expediente expediente) {
        em.merge(expediente);
    }

    public void remove(Expediente expediente) {
        em.remove(em.merge(expediente));
    }

    public Expediente find(Object id) {
        return em.find(Expediente.class, id);
    }

    public List<Expediente> findAll() {
        return em.createQuery("select object(o) from Expediente as o").getResultList();
    }
}
